<!--// header //--> 
{include="../public/header"}
<style>
    .the-legend {
        border-style: none;
        border-width: 0;
        font-size: 14px;
        line-height: 20px;
        margin-bottom: 0;
    }
    .the-fieldset {
        border: 2px groove threedface #444;
        -webkit-box-shadow:  0px 0px 0px 0px #000;
        box-shadow:  0px 0px 0px 0px #000;
    }
</style>
<!--主体内容-->
<!--当前操作-->
<div style="margin-left:65px; margin-right:65px; width:auto">
    <div class="row-fluid">
        <div class="span12">
            <h2 style="margin:12px; color:#41516a">收入与支出</h2>
        </div>
    </div>		
    <!--当前操作-->
    <div class="row-fluid">
        <div class="span12">
            <div class="row-fluid">
                <!--tab-->
                <div class="tabbable">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#1" data-toggle="tab"><font color="orange">收入</font></a></li>
                        <li><a href="#2" data-toggle="tab">支出</a></li>
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active" id="1">
                            <div class="tabbable">
                                <ul class="nav nav-tabs">
                                    <li class="active"><a href="#11" data-toggle="tab"><font color="orange">学费收入</font></a></li>
                                    <li><a href="#12" data-toggle="tab">书本收入</a></li>
                                    <li><a href="#13" data-toggle="tab">其他收入</a></li>
                                </ul>
                                <div class="tab-content">
                                    <div class="tab-pane active" id="11">
                                        <div class="tabbable">
                                            <ul class="nav nav-tabs">
                                                <li class="active"><a href="#111" data-toggle="tab"><font color="orange">本年学费收入</font></a></li>
                                                <li><a href="#112" data-toggle="tab">本月学费收入</a></li>
                                                <li><a href="#113" data-toggle="tab">本周学费收入</a></li>
                                            </ul>
                                            <div class="tab-content">
                                                <div class="tab-pane active" id="111">
                                                    <a href="javascript:get_year_in();" id="yearin">载入本年学费收入</a>
                                                    <table class='table table-bordered'>
                                                        <thead>
                                                            <tr><td>学生姓名</td><td>课程</td><td>班级</td><td>学费</td><td>报名时间</td></tr>
                                                        </thead>
                                                        <tbody id="yearcount"></tbody>
                                                        <tbody id="addyeartr"></tbody>
                                                    </table>
                                                </div>
                                                <div class="tab-pane" id="112">
                                                    <a href="javascript:get_month_in();" id="monthin">载入本月学费收入</a>
                                                    <table class='table table-bordered'>
                                                        <thead>
                                                            <tr><td>学生姓名</td><td>课程</td><td>班级</td><td>学费</td><td>报名时间</td></tr>
                                                        </thead>
                                                        <tbody id="monthcount"></tbody>
                                                        <tbody id="addmonthtr"></tbody>
                                                    </table>
                                                </div>
                                                <div class="tab-pane" id="113">
                                                    <a href="javascript:get_week_in();" id="weekin">载入本周学费收入</a>
                                                    <table class='table table-bordered'>
                                                        <thead>
                                                            <tr><td>学生姓名</td><td>课程</td><td>班级</td><td>学费</td><td>报名时间</td></tr>
                                                        </thead>
                                                        <tbody id="weekcount"></tbody>
                                                        <tbody id="addweektr"></tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="tab-pane" id="12">
                                        年书本收入
                                    </div>
                                    <div class="tab-pane" id="13">
                                        年其他收入
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane" id="2">
                            <div class="tabbable">
                                <ul class="nav nav-tabs">
                                    <li class="active"><a href="#21" data-toggle="tab"><font color="orange">日常支出</font></a></li>
                                    <li><a href="#22" data-toggle="tab">其他支出</a></li>
                                </ul>
                                <div class="tab-content">
                                    <div class="tab-pane active" id="21">
                                        <div class="tabbable">
                                            <ul class="nav nav-tabs">
                                                <li class="active"><a href="#211" data-toggle="tab"><font color="orange">本年支出</font></a></li>
                                                <li><a href="#212" data-toggle="tab">本月支出</a></li>
                                                <li><a href="#213" data-toggle="tab">本周支出</a></li>
                                            </ul>
                                            <div class="tab-content">
                                                <div class="tab-pane active" id="211">
                                                    年支出
                                                </div>
                                                <div class="tab-pane" id="212">
                                                    月支出
                                                </div>
                                                <div class="tab-pane" id="213">
                                                    周支出
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="tab-pane" id="22">
                                        年其他支出
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--tab-->
                </div>
            </div>
        </div>
    </div>
    <!--主体内容-->
    <script>
        function get_year_in(){
            $("#yearin").removeAttr('href');
            $.ajax({
                type: "get",
                url: "/Finance/yearin",
                success: function(returndata){
                    data = eval('(' + returndata + ')')
                    if(data.message == 'ok'){
                        var obj = data.result.data;
                        $(obj).each(function(index) { 
                            var val = obj[index];
                            var dom_tr = $('<tr></tr>');
                            var dom_td = $("<td>" + val.uName + "</td><td>" + val.cId + "</td><td>" + val.gid + "</td><td>" + val.uPayfee + "</td><td>" + val.createat + "</td>");
                            dom_tr.append(dom_td);
                            $("#addyeartr").append(dom_tr);
                        }); 
                        var btw = data.result.between;
                        var sts = data.result.students;
                        var fee = data.result.totalfee;
                        var dom_tr_count = $('<tr></tr>');
                        var dom_td_count = $("<td colspan='5'><font color='blue' size='5px'><em>" + btw.begin + "</em></font> ~ <font color='blue' size='5px'><em>" + btw.end +"</em></font>,累计招生<font color='blue' size='5px'><em>" + sts + "人</em></font>,学费收入总计<font color='blue' size='5px'><em>" + fee + "</em></font></td>");
                        dom_tr_count.append(dom_td_count);
                        $("#yearcount").append(dom_tr_count);
                    }else{
                        alert('failed');
                    }
                    //                    $("#year_in").html(data);
                },
                error: function(){
                    alert('Error!');
                    //请求出错处理
                }
            });
        }
        
        function get_month_in(){
            $("#monthin").removeAttr('href');
            $.ajax({
                type: "get",
                url: "/Finance/monthin",
                success: function(returndata){
                    data = eval('(' + returndata + ')')
                    if(data.message == 'ok'){
                        var obj = data.result.data;
                        $(obj).each(function(index) { 
                            var val = obj[index];
                            var dom_tr = $('<tr></tr>');
                            var dom_td = $("<td>" + val.uName + "</td><td>" + val.cId + "</td><td>" + val.gid + "</td><td>" + val.uPayfee + "</td><td>" + val.createat + "</td>");
                            dom_tr.append(dom_td);
                            $("#addmonthtr").append(dom_tr); 
                            //                            alert(val.id + " " + val.uSchool + " " + val.uFather);
                        });
                        var btw = data.result.between;
                        var sts = data.result.students;
                        var fee = data.result.totalfee;
                        var dom_tr_count = $('<tr></tr>');
                        var dom_td_count = $("<td colspan='5'><font color='blue' size='5px'><em>" + btw.begin + "</em></font> ~ <font color='blue' size='5px'><em>" + btw.end +"</em></font>,累计招生<font color='blue' size='5px'><em>" + sts + "人</em></font>,学费收入总计<font color='blue' size='5px'><em>" + fee + "</em></font></td>");
                        dom_tr_count.append(dom_td_count);
                        $("#monthcount").append(dom_tr_count);
                    }else{
                        alert('failed');
                    }
                    //                    $("#year_in").html(data);
                },
                error: function(){
                    alert('Error!');
                    //请求出错处理
                }
            });
        }
        
        function get_week_in(){
            $("#weekin").removeAttr('href');
            $.ajax({
                type: "get",
                url: "/Finance/weekin",
                success: function(returndata){
                    data = eval('(' + returndata + ')')
                    if(data.message == 'ok'){
                        var obj = data.result.data;
                        $(obj).each(function(index) { 
                            var val = obj[index];
                            var dom_tr = $('<tr></tr>');
                            var dom_td = $("<td>" + val.uName + "</td><td>" + val.cId + "</td><td>" + val.gid + "</td><td>" + val.uPayfee + "</td><td>" + val.createat + "</td>");
                            dom_tr.append(dom_td);
                            $("#addweektr").append(dom_tr); 
                            //                            alert(val.id + " " + val.uSchool + " " + val.uFather);
                        });
                        var btw = data.result.between;
                        var sts = data.result.students;
                        var fee = data.result.totalfee;
                        var dom_tr_count = $('<tr></tr>');
                        var dom_td_count = $("<td colspan='5'><font color='blue' size='5px'><em>" + btw.begin + "</em></font> ~ <font color='blue' size='5px'><em>" + btw.end +"</em></font>,累计招生<font color='blue' size='5px'><em>" + sts + "人</em></font>,学费收入总计<font color='blue' size='5px'><em>" + fee + "</em></font></td>");
                        dom_tr_count.append(dom_td_count);
                        $("#weekcount").append(dom_tr_count);
                    }else{
                        alert('failed');
                    }
                    //                    $("#year_in").html(data);
                },
                error: function(){
                    alert('Error!');
                    //请求出错处理
                }
            });
        }
    </script>
    <!--// footer //--> 
    {include="../public/footer"}